package cn.zqy.demo.day11.demo04;


// 类作为变量的类型
public class Demo01ClassField {
    public static void main(String[] args) {
        Hero hero = new Hero();
        hero.setAge(35);
        hero.setName("马克");

        Weapon wp = new  Weapon("暴风大剑");
        // 装备武器
        hero.setWeapon(wp);

        // 设置技能1
        Skill ss = new SkillImpl();
        hero.setSkill(ss);
        hero.show();

        System.out.println("=================");
        // 设置技能2
        Skill sk = new Skill() {
            @Override
            public void use() {
                System.out.println("fafafafa...");
            }
        };
        hero.setSkill(sk);
        hero.show();
    }
}
